-
Notifications
You must be signed in to change notification settings - Fork 53
Allow using editor as file browser #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: robert-hh <[email protected]>
When opening a dir the dir is listed. When viewing a dir listing and positioning the cursor over a file name and pressing Ctrl-O, the file name is used as the default value for the filename prompt.
| key = self.handle_edit_keys(key, char) | ||
| if key == KEY_QUIT: | ||
| if self.hash != self.hash_buffer(): | ||
| if self.hash != self.hash_buffer() and not self.is_dir: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Directory listings were intentionally included into the change check. I do not think that this is a major problem.
| os.chdir(fname) | ||
| if fname in (".", "..", "") or (os.stat(fname)[0] & 0x4000): ## Dir | ||
| os.chdir(fname or ".") | ||
| self.work_dir = os.getcwd() # let the os module do the normalization |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An empty file name is meant to open an edit window without a file name, not a directory listing.
| elif key == KEY_GET: | ||
| f = slot[index].line_edit("Open file: ", "", Editor.file_char) | ||
| dfn = slot[index].content[slot[index].cur_line].strip() if slot[index].is_dir else "" | ||
| f = slot[index].line_edit("Open file: ", dfn, Editor.file_char) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To take the file name at the cursor as default name seems intuitive. ATM, you can use CTRL-V in the file name field to copy the text under the cursor. The same thing applies for find.
|
Thank you for the PR. I have to think about it. I hope that you noticed, that only pye_core has to be edited. Once you run strip.sh, the other files will be created. |
a10f174 to
b72717f
Compare
When opening a dir, the dir is listed.
When viewing a dir listing and positioning the cursor over a file name and pressing Ctrl-O,
the file name is used as the default value for the filename prompt.